<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/10/12 0012
 * Time: 下午 8:35
 */
header('Content-type:text/html;charset=utf-8');
$link = mysql_connect('localhost','root','123456');
if(!$link){
    die('连接数据库失败！'.mysql_error());
}
mysql_query('set names utf8');
mysql_query('use `itcast`');
$sql = 'select *form `emp_info`';
$result = mysql_query($sql,$link);
$emp_info = array();
    whlie($row = mysql_fetch_assoc($res)){
        $emp_info[] = $row;
    }
define('APP','itcast');
requie './list_html.php';
$fields = array('e_dept','data_of_entry');
$sql_order = '';
$order = isset($_GET['order']) ? $_GET['order'] : '';
$sort = isset($_GET['sort']) ? $_GET['sort'] : '';
if (in_array($order,$fields)){
    if ($sort == 'desc'){
        $sql_order = "order by $order desc";
        $sort = 'asc';
    }else{
        $sql_order = "order by $order asc";
        $sort = 'desc';
    }
}
